﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;

class SearchTelephnes
{
    const string TELEPHONE_PATTERN = "[+][\\d]{3}-[\\d]{3}-[\\d]{3}";

    static void Search()
    {
        using(var reader = new StreamReader("../../example.txt"))
        {
            using(var writer = new StreamWriter("../../phones.txt"))
            {
                string fullText = reader.ReadToEnd();
                Match matcher = Regex.Match(fullText, TELEPHONE_PATTERN);

                while (matcher.Success)
                {
                    writer.WriteLine(matcher.Value);
                    //Console.WriteLine(matcher.Value);

                    matcher = matcher.NextMatch();
                }
            }
        }
    }

    static void Main(string[] args)
    {
        Search();
    }
}

